	<#include "/admin/system/metadata/table/head.html">
	<div class="layui-tab">
	  <div class="layui-tab-content" style="padding:0px;">
	    <div class="layui-tab-item layui-show">
			<div class="box default-box" style="height: 100%;">
				<div class="box-header">
					<h3 class="box-title">
						数据表结构列表<#if propertiesList??>（${propertiesList?size!''}）</#if>
					</h3>
				</div>
				<div class="box-body ukefu-im-theme">
					<#if propertiesList?? && propertiesList?size gt 0>
						<div class="row" style="padding:5px;">
							<div class="col-lg-12">
								<table class="layui-table" lay-skin="line">
								  <thead>
									<tr>
									  <th>
									  	  <input type="checkbox" id="all" onclick="$('.ids').prop('checked' , $(this).prop('checked'));"/>
									  </th>
									  <th>标题</th>
									  <th>字段</th>
									  <th>校验</th>
									  <th>长度</th>
									  <th>关联</th>
									  <th>生成ID</th>
									  <th>多值</th>
									  <th>启用字典</th>
									  <th>禁用导入导出</th>
									  <th>流程变量</th>
									  <th>显示位置</th>
									  <th style="white-space:nowrap;" nowrap="nowrap">操作</th>
									</tr> 
								  </thead>
								  <tbody>
									<#if propertiesList??>
									<#list propertiesList as prop>
									<tr>
									  <td style="width:1%;">
										<input type="checkbox" class="ids" name="ids" value="${prop.id!''}"/>
									  </td>
									  <td>
									  	${prop.name!''}	
									  </td>
									  <td>${prop.fieldname!''}（${prop.datatypename!''}）</td>
									  <td>${prop.defaultvaluetitle!''}</td>
									  <td>${prop.length!''}</td>
									  <td align="center"><#if prop.reffk == true><i class="layui-icon"  class="green">&#xe605;</#if></td>
									  <td align="center"><#if prop.pk == true><i class="layui-icon" class="green">&#xe605;</#if></td>
									  <td align="center"><#if prop.modits == true><i class="layui-icon" class="green">&#xe605;</#if></td>
									  
									  <td align="center"><#if prop.seldata == true><i class="layui-icon" title="${prop.seldatacode!''}" class="green">&#xe605;</#if></td>
									  <td align="center"><#if prop.impfield == true><i class="layui-icon">&#xe605;</#if></td>
									  <td align="center"><#if prop.systemfield == true><i class="layui-icon">&#xe605;</#if></td>
									  <td>${prop.viewtype!''}</td>
									  <td style="white-space:nowrap;width:1%;" nowrap="nowrap">
											<a href="/admin/metadata/properties/edit.html?id=${prop.id!''}&p=${metadataList.number+1}" data-width="650" data-height="460" data-toggle="ajax" title="编辑${table.name!''}">
												<i class="layui-icon">&#xe642;</i>
												编辑
											</a>
											<a href="/admin/metadata/properties/delete.html?id=${prop.id!''}&tbid=${prop.dbtableid!''}" data-toggle="tip" data-title="删除数据表项同时会删除数据表元数据下的所有内容，请确认是否删除数据表“${prop.name!''}”？" title="删除${prop.name!''}">
												<i class="layui-icon" style="color:red;">&#x1006;</i>
												删除
											</a>
									  </td>
									</tr>
									</#list>
									</#if>
								  </tbody>
								</table>
							</div> 	   
						</div>
					<#else>
					<div class="ukefu-empty">
						<i class="layui-icon"></i>
						<div style="">
							还没有数据表记录
						</div>
					</div>	
					</#if>
				</div>
			</div>
		</div>
	</div>
</div>
<script>
	$(document).ready(function(){
		$('#batdel').click(function(){
			var ids = "";
			var num = 0 ;
			$('.ids').each(function(){
				if($(this).prop("checked")){
					if(ids!=""){
						ids += "&" ;
					}
					ids += "ids=" + $(this).val();
					num++;
				}
			});
			if(num > 0){
				
				$('#batdel').attr('href' , '/admin/metadata/properties/batdelete.html?tbid=${tbid!''}&'+ids+"&tabletype=${tabletype!''}")	;
			}else{
				top.layer.alert("请先选择记录再操作！");
			}
			
		});
		$('#batedit').click(function(){
			var ids = "";
			var num = 0 ;
			$('.ids').each(function(){
				if($(this).prop("checked")){
					if(ids!=""){
						ids += "&" ;
					}
					ids += "ids=" + $(this).val();
					num++;
				}
			});
			if(num > 0){
				
				$('#batedit').attr('href' , '/admin/metadata/properties/update/mul.html?dbtableid=${table.dbtableid!''}&tbid=${tbid!''}&'+ids+"&tabletype=${tabletype!''}")	;
			}else{
				top.layer.alert("请先选择记录再操作！");
			}
			
		});
	});	
	layui.use('layer', function(){
		  var layer = layui.layer;
		  <#if msg?? && msg == 'bat_delete_success'>
		  layer.alert('批量删除元数据成功！', {icon: 6});
		  <#elseif msg?? && msg == 'bat_delete_faild'>
		  layer.alert('请勾选需要删除的记录！', {icon: 5});
		  </#if>
		}); 
</script>
